package com.cryann.mqttserver.config.aop;

import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.context.annotation.Configuration;

/**
 * @author: cRyann
 * @date: 2019/10/18 17:41
 * @description:
 **/
@Aspect
@Configuration
@Slf4j
public class ProcessAop {
    @Pointcut("execution(* com.cryann.mqttserver.mqttProcess..process(..))")
    public void excudeService() {
    }

    @Before("excudeService()")
    public void beforeAop(JoinPoint joinPoint) {
        log.info("[{}] Started", joinPoint.getTarget().getClass().getSimpleName());
    }

    @After("excudeService()")
    public void afterAop(JoinPoint joinPoint) {
        log.info("[{}] Completed", joinPoint.getTarget().getClass().getSimpleName());
    }
}
